using System.Threading.Tasks;
using System.Collections.Generic;
using JGSY.CMS.LowCode.Platform.Application.DTOs;

namespace JGSY.CMS.LowCode.Platform.Application.Interfaces
{
    /// <summary>
    /// 内容管理应用服务接口。
    /// 提供内容模型、字段、内容项的增删改查等内容管理相关业务功能接口定义。
    /// </summary>
    public interface IContentAppService
    {
        /// <summary>
        /// 获取所有内容模型
        /// </summary>
        /// <returns>内容模型列表</returns>
        Task<IEnumerable<ContentModelDto>> GetAllModelsAsync();
        
        /// <summary>
        /// 根据ID获取内容模型
        /// </summary>
        /// <param name="id">模型标识符</param>
        /// <returns>内容模型信息</returns>
        Task<ContentModelDto?> GetModelByIdAsync(long id);
        
        /// <summary>
        /// 创建内容模型
        /// </summary>
        /// <param name="model">内容模型数据传输对象</param>
        /// <returns>创建任务</returns>
        Task CreateModelAsync(ContentModelDto model);
        
        /// <summary>
        /// 更新内容模型
        /// </summary>
        /// <param name="id">模型标识符</param>
        /// <param name="model">内容模型数据传输对象</param>
        /// <returns>更新任务</returns>
        Task UpdateModelAsync(long id, ContentModelDto model);
        
        /// <summary>
        /// 删除内容模型
        /// </summary>
        /// <param name="id">模型标识符</param>
        /// <returns>删除任务</returns>
        Task DeleteModelAsync(long id);
        
        /// <summary>
        /// 获取指定模型的所有字段
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <returns>字段列表</returns>
        Task<IEnumerable<FieldDto>> GetFieldsAsync(long modelId);
        
        /// <summary>
        /// 为模型添加字段
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="field">字段数据传输对象</param>
        /// <returns>添加任务</returns>
        Task AddFieldAsync(long modelId, FieldDto field);
        
        /// <summary>
        /// 更新模型字段
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="fieldId">字段标识符</param>
        /// <param name="field">字段数据传输对象</param>
        /// <returns>更新任务</returns>
        Task UpdateFieldAsync(long modelId, long fieldId, FieldDto field);
        
        /// <summary>
        /// 删除模型字段
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="fieldId">字段标识符</param>
        /// <returns>删除任务</returns>
        Task DeleteFieldAsync(long modelId, long fieldId);
        
        /// <summary>
        /// 分页获取内容项
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="page">页码，默认为1</param>
        /// <param name="limit">每页数量，默认为10</param>
        /// <returns>内容项列表</returns>
        Task<IEnumerable<ContentItemDto>> GetItemsAsync(long modelId, int page = 1, int limit = 10);
        
        /// <summary>
        /// 创建内容项
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="item">内容项数据传输对象</param>
        /// <returns>创建任务</returns>
        Task CreateItemAsync(long modelId, ContentItemDto item);
        
        /// <summary>
        /// 根据ID获取内容项
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="itemId">内容项标识符</param>
        /// <returns>内容项信息</returns>
        Task<ContentItemDto?> GetItemByIdAsync(long modelId, long itemId);
        
        /// <summary>
        /// 更新内容项
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="itemId">内容项标识符</param>
        /// <param name="item">内容项数据传输对象</param>
        /// <returns>更新任务</returns>
        Task UpdateItemAsync(long modelId, long itemId, ContentItemDto item);
        
        /// <summary>
        /// 删除内容项
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="itemId">内容项标识符</param>
        /// <returns>删除任务</returns>
        Task DeleteItemAsync(long modelId, long itemId);
        
        /// <summary>
        /// 获取内容项状态
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="itemId">内容项标识符</param>
        /// <returns>状态信息</returns>
        Task<object?> GetItemStatusAsync(long modelId, long itemId);
        
        /// <summary>
        /// 更改内容项状态
        /// </summary>
        /// <param name="modelId">模型标识符</param>
        /// <param name="itemId">内容项标识符</param>
        /// <param name="status">新状态</param>
        /// <returns>状态更改任务</returns>
        Task ChangeItemStatusAsync(long modelId, long itemId, string status);
    }
}
